import React from 'react';
import {
  Dialog,
  Button,
  DialogActions,
  DialogContent,
  DialogContentText,
  DialogTitle,
} from '@mui/material';

interface DialogBoxProps {
  open: boolean;
  onDialogResponse: (confirmed: boolean) => void;
  textForDialog?: {
    heading?: string;
    content?: string;
  };
}

const DialogBox: React.FC<DialogBoxProps> = ({
  open,
  onDialogResponse,
  textForDialog,
}) => {
  return (
    <Dialog open={open}>
      <DialogTitle>{textForDialog?.heading}</DialogTitle>
      <DialogContent>
        <DialogContentText>{textForDialog?.content}</DialogContentText>
      </DialogContent>
      <DialogActions>
        <Button id="confirmCancel" onClick={() => onDialogResponse(false)}>
          Cancel
        </Button>
        <Button
          id="confirmDeletion"
          color="primary"
          onClick={() => onDialogResponse(true)}
        >
          Confirm
        </Button>
      </DialogActions>
    </Dialog>
  );
};

export default DialogBox;

